package com.citywithincity.http;

import java.util.Map;
import java.util.Map.Entry;

public class PostUtil {
	/**
	 * 
	 * @param map
	 * @return
	 */
	public static String mapToUrlEncodedString(Map<String, Object> map){
		if(map==null)return null;
		StringBuilder sb = new StringBuilder();
		boolean first = true;
		for (Entry<String, Object> entry : map.entrySet()) {
			if(first){
				first = false;
			}else{
				sb.append('&');
			}
			sb.append(entry.getKey()).append('=')
			.append(entry.getValue());
		}
		return sb.toString();
	}
}
